package domaine;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Entity
@Table(schema="FINITO",name="APPRENTIS_PIZZAIOLOS",uniqueConstraints={@UniqueConstraint(columnNames={"email"})})
public class ApprentiPizzaiolo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1289470672545949687L;
	
	@Id
	private String pseudo;

	@NotNull
	private String nom;

	@NotNull
	private String prenom;

	@NotNull
	@Pattern(regexp=".+@.+\\..+")
	private String email;

	@NotNull
	private String mdp;

	protected ApprentiPizzaiolo() {}

	public ApprentiPizzaiolo(String pseudo, String nom, String prenom,
			String email,String mdp) {
		this.pseudo = pseudo;
		this.nom = nom;
		this.prenom = prenom;
		this.email = email;
		this.mdp=mdp;
	}

	public String getPseudo() {
		return pseudo;
	}

	public String getNom() {
		return nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public String getEmail() {
		return email;
	}

	
	public String getMdp() {
		return mdp;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pseudo == null) ? 0 : pseudo.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ApprentiPizzaiolo other = (ApprentiPizzaiolo) obj;
		if (pseudo == null) {
			if (other.pseudo != null)
				return false;
		} else if (!pseudo.equals(other.pseudo))
			return false;
		return true;
	}

}
